/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package HumanCentredSystemDesign;

import java.util.ArrayList;

/**
 *
 * @author Martin
 */
public class ConnectTests {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Connect myConnection = new Connect();
        myConnection.establishConnection();
        //myConnection.SelectBorrowerFromDatabase("SELECT * FROM Borrowers");
        myConnection.closeConnection();

        System.out.println("Test 2 - Testing getting a borrower from the database");
        Connect myConnection2 = new Connect();
        myConnection2.establishConnection();
        ArrayList<Borrower> myBorrowerList = myConnection2.getBorrowersFromDatabase("","Martin", "", "");
        Borrower myBorrower = myBorrowerList.get(0);
        myBorrower.toString();
        myConnection2.closeConnection();
        
        
        System.out.println("Test 3 - Testing to get a borrowers loans");        
        ArrayList<Loan> myBorrowersLoans = myBorrower.getLoans();
        for  (Loan l : myBorrowersLoans)
        {
            Copy loanCopy = l.getLoanedCopy();
            System.out.println(loanCopy.toString());
        }
        
        
        System.out.println("Test 4 - Testing getting a book");
        // Testing getting a book and its copies
        Connect myConnection4 = new Connect();
        myConnection4.establishConnection();
        ArrayList<Item> myBooks = myConnection4.getBooksFromDatabase("","", "", "","");
        System.out.println(myBooks.toString());
        myConnection4.closeConnection();
        
        System.out.println("Test 5- Testing getting periodical");
        Connect myConnection5 = new Connect();
        myConnection5.establishConnection();
        ArrayList<Item> myPeriodicals = myConnection5.getPeriodicalsFromDatabase("","", "", "", "","");
        System.out.println(myPeriodicals.toString());
        //System.out.println(myPeriodical.toStringCopies());
        myConnection5.closeConnection();
        
        System.out.println("THIS IS TO TEST RESERVATIONS GETTING");

        Connect myConnection6 = new Connect();
        myConnection6.establishConnection();
        ArrayList<Reservation> myReservations = myConnection6.getReservationsFromDatabase("", "");
        for (Reservation r : myReservations)
        {
            r.toString();
        }
        myConnection6.closeConnection();
        
    }
}
